import { request } from "./com";
export const newReward = async (user_id: number, name: string, des: string, points: number) => {
    const response = await request.post('api/rewards', {

        user_id: user_id,
        reward_name: name,
        description: des,
        points_cost: points

    })
    return response
}
export const putReward = async (reward_id: number, name?: string, des?: string, points?: number) => {
    const response = await request.put(`api/rewards/${reward_id}`, {

        reward_name: name,
        description: des,
        points_cost: points

    })
    return response
}
export const redeemReward = async (reward_id: number, user_id: number) => {
    const response = await request.post(`api/rewards/${reward_id}/redeem`, {

        reward_id: reward_id,
        user_id: user_id

    })
    return response
}
export const getRewardList = async (user_id: number) => {
    const response = await request.get('api/rewards', {
        params: {
            user_id: user_id
        }
    })
    return response
}